<?php
namespace Business\Controller;
use Think\Controller;
class OrderController extends BaseController{
//class OrderController extends Controller{
		
	public static $session;		//SESSION
	public static $ordertype;
	public static $entry;
	protected function _initialize(){
		parent::_initialize();
		
		header("Content-Type: text/html;charset=utf-8");
		$this->assign('tj',time());
		self::$session=$_SESSION['business'];		//session
	
		//p(self::$session);
		self::$entry=array('1'=>'普洗袋洗','2'=>'品牌精洗','3'=>'洗鞋','4'=>'洗涤救治','5'=>'家政服务','6'=>'奢侈品护理');
		self::$ordertype=array('0'=>'派单中','1'=>'待收衣','2'=>'已确认','3'=>'已支付','4'=>'洗涤中','5'=>'待送衣','6'=>'已完成','7'=>'已评论','9'=>'已取消');
		$this->assign('session',self::$session);
		$this->assign('ordertype',self::$ordertype);
		$this->assign('entry',self::$entry);
	}

    public function index(){
		$this->display();
    }
	
	public function lists(){
		
		$order=M('bb_order')->where(array('shopid'=>self::$session['shop']['shopid'],'status'=>'3'))->order('addtime desc')->select();
		foreach ($order as $k => $v) {
			$uimg=M('weixin_client_user')->field('headimgurl')->where(array('openid'=>$v['openid']))->find();
			$order[$k]['uimg']=$uimg['headimgurl'];
		}
		$this->assign('order',$order);
		$this->display();
	}
	
	public function lists2(){
		$order=M('bb_order')->where(array('shopid'=>self::$session['shop']['shopid'],'status'=>'4'))->order('addtime desc')->select();
		foreach ($order as $k => $v) {
			$uimg=M('weixin_client_user')->field('headimgurl')->where(array('openid'=>$v['openid']))->find();
			$order[$k]['uimg']=$uimg['headimgurl'];
		}
		$this->assign('order',$order);
		$this->display();
	}
	
	public function lists3(){
		$order=M('bb_order')->where(array('shopid'=>self::$session['shop']['shopid'],'status'=>'6'))->order('addtime desc')->select();
		foreach ($order as $k => $v) {
			$uimg=M('weixin_client_user')->field('headimgurl')->where(array('openid'=>$v['openid']))->find();
			$order[$k]['uimg']=$uimg['headimgurl'];
		}
		$this->assign('order',$order);
		$this->display();
	}
	//=======
	public function orderinfo(){
		//p(I('get.'));
		$orderid=I('orderid');
		$order=M('bb_order')->where(array('orderid'=>$orderid))->find();
		$this->assign('order',$order);
		$order2=M('bb_order_yifu')->where(array('orderid'=>$orderid))->select();
		$this->assign('yifulist',$order2);
		$order3=M('bb_order_img')->where(array('orderid'=>$orderid))->select();
		$this->assign('yifuimg',$order3);
		$this->display();
	}
	
}